package com.mengshu.token.handler;

import org.springframework.web.method.HandlerMethod;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
 * <p>
 *     token/权限验证失败处理器
 *     不定义此处理器将直接抛TokenException/PermissionException异常
 * </p>
 *
 * @author liuning
 * @date 3:03 下午 2022/1/31
 */
public interface PermissionFailureHandler {

    /**
     * token验证失败处理
     *
     * @param request
     * @param response
     * @param handlerMethod
     * @return 是否继续
     */
    boolean failureToken(HttpServletRequest request, HttpServletResponse response, HandlerMethod handlerMethod);

    /**
     * 权限验证失败处理
     *
     * @param request
     * @param response
     * @param handlerMethod
     * @return 是否继续
     */
    boolean failurePermission(HttpServletRequest request, HttpServletResponse response, HandlerMethod handlerMethod);
}
